<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/base_body_header.jsp" %>
<%@include file="../common/navbar.jsp" %>
<%@include file="../common/page_content_pre.jsp" %>

<link rel="stylesheet" href="${GLOBAL.staticJsPath}/assets/qiniu/fileupload.css"/>

<div class="page-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="widget-box">
                <div class="widget-header">
                    <h4>${not empty customer.customerId?'修改':'添加'}客户</h4>
                </div>

                <div class="widget-body">
                    <div class="widget-main no-padding">
                        <form:form class="form-horizontal" modelAttribute="customer" enctype="multipart/form-data"
                                   action="${GLOBAL.basePath}/customer/save" method="post" id="customerForm">
                            <form:input path="customerId" type="hidden"/>
                            <fieldset>
                                <div class="form-group">
                                    <span class="col-sm-3 control-label">客户编号：</span>
                                    <label class="control-label">${customer.customerId}</label>
                                </div>
                            </fieldset>

                            <fieldset>
                                <div class="form-group">
                                    <span class="col-sm-3 control-label">客户姓名：</span>
                                    <label class="control-label">${customer.customerName}</label>
                                </div>
                            </fieldset>

                            <fieldset>
                                <div class="form-group">
                                    <span class="col-sm-3 control-label">联系方式：</span>
                                    <label class="control-label">${customer.customerPhone}</label>
                                </div>
                            </fieldset>

                            <fieldset>
                                <div class="form-group">
                                    <span class="col-sm-3 control-label">客户状态：</span>
                                    <c:choose>
                                        <c:when test="${customer.staus ==1}">
                                            <label class="control-label">跟进中</label>
                                        </c:when>
                                        <c:when test="${customer.staus ==2}">
                                            <label class="control-label">已签约</label>
                                        </c:when>
                                        <c:when test="${customer.staus ==3}">
                                            <label class="control-label">抢单待处理</label>
                                        </c:when>
                                        <c:otherwise>
                                            <label class="control-label">无效</label>
                                        </c:otherwise>
                                    </c:choose>
                                </div>
                            </fieldset>

                            <fieldset>
                                <div class="form-group">
                                    <span class="col-sm-3 control-label">创建时间：</span>
                                    <label class="control-label">${customer.createDate}</label>
                                </div>
                            </fieldset>

                            <fieldset>
                                <div class="form-group">
                                    <span class="col-sm-3 control-label">跟进记录：</span>
                                    <div class="col-sm-8">
                                        <c:forEach items="${followRecords}" var="item" varStatus="vst">
                                            <label class="control-label">${item.updateDate}: ${item.text}</label>
                                            <br>
                                        </c:forEach>
                                    </div>
                                </div>
                            </fieldset>


                            <div class="form-actions center">
                                <button type="button" class="btn btn-sm btn-grey" id="go_back_btn">
                                    返回
                                    <i class="icon-reply icon-on-right bigger-110"></i>
                                </button>
                            </div>
                        </form:form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<%@include file="../common/page_content_suf.jsp" %>
<%@include file="../common/script.jsp" %>

<script type="text/javascript">
    $(document).ready(function () {
        $("#go_back_btn").on("click", function () {
            goBack();
        });
    });

    function goBack() {
        document.location.href = "${GLOBAL.basePath}/customer/list";
    }
</script>
